Breeding
This page describes how breeding works, both deciding when to do it and what the resultant Pokémon egg will be. Deciding when an egg is available Every 256 steps the player takes, the game checks whether it should generate an egg in the Day Care Center. The code that does this is at the bottom of the script section PField_DayCare. It first checks various criteria, which are: * There must be exactly 2 Pokémon deposited in the Day Care (neither of which are Shadow Pokémon). * There is no egg already waiting to be collected by the player. * The two deposited Pokémon are in compatible egg groups. ** Either they share an egg group, or exactly one is in the Ditto egg group. Neither can be in the Undiscovered egg group. * The two deposited Pokémon are of compatible genders. ** Either one is male and the other female, or exactly one is in the Ditto egg group. Assuming all of the above criteria are met, the game generates an egg generation probability, which is higher if the two Pokémon are of the same species and/or have different original trainers. The probability is also increased by the Oval Charm item. The egg generation probability is then used to decide if an egg should be generated. If so, the value of $PokemonGlobal.daycareEgg is set to 1 to indicate this (a value of 0 means no egg is available). Note that the egg itself is not yet created. The only thing determined at this time is whether the player will be given an egg when they talk to the old man at the Day Care Center. The egg itself is generated during this conversation, when it is given to the player. Generating an egg If an egg is waiting at the Day Care Center for the player to collect, interacting with the old man outside will allow the player to receive it. The egg is generated at this time. Generating the egg is done in def pbDayCareGenerateEgg, which also then gives the egg to the player. The first step is to decide which of the two deposited Pokémon is the mother and which is the father. The mother is either the female Pokémon, or is the non-Ditto if one of the two is in the Ditto egg group. The father is the other Pokémon (the one that isn't determined to be the mother). The species of Pokémon in the egg is inherited from the mother. The lowest prevolution of the mother's species is chosen for this. However, if a prevolution is defined with an Incense item, and neither parent is holding that item, the next evolved species in the evolutionary family is used instead. Additionally, there is code which can modify the egg Pokémon's species as follows: * If the egg should be a Manaphy, it will be a Phione instead. * If the egg will be a Nidoran male or Nidoran female, it will instead have a 50% chance of being either of them. * If the egg will be a Volbeat or an Illumise, it will instead have a 50% chance of being either of them. The egg Pokémon can then inherit a number of properties from one or both of its parents. These include: * Form (Burmy, Shellos, Basculin and a few other species inherit this from the mother) * Moves (including Volt Tackle for a baby Pichu if either parent is holding a Light Ball) * IVs (from either parent, 3 of them, or 5 if either parent is holding a Destiny Knot) * Nature (from any parent that is holding an Ever Stone) * Ability (from the mother or non-Ditto parent) * Poké Ball (from the mother, if it is not a Cherish Ball or Master Ball) Some parts of the above inheritances depend on whether the USENEWBATTLEMECHANICS setting is true or false. The following things also happen: * The Shiny Charm has its effect, if the player owns it. * The egg's level is set to the value of EGGINITIALLEVEL, as defined in the script section Settings. * The egg's nickname is set to "Egg" (and is erased once it hatches). * The egg's obtainText (seen in its summary screens) is set to "Day-Care Couple". * The egg has a chance of contracting Pokérus. * The number of steps required for the egg to hatch (as defined in the PBS file "pokemon.txt") is set. Giving the egg to the player An egg from the Day Care can only be added to the player's party, meaning there needs to be an empty space in their party. As mentioned above, the script pbDayCareGenerateEgg not only generates the egg, but also gives it to the player. This is done silently, without displaying any messages. You will therefore need to add messages to the event in which you call this script, to indicate what has happened. Afterwards, you must also run the following code: $PokemonGlobal.daycareEgg = 0 $PokemonGlobal.daycareEggSteps = 0 The first line turns off the flag that says an egg is available at the Day Care. The second line resets the 256-step count, to make sure that another egg can't become available almost immediately. Tips * Give the player a phone number for the Day Care. The Day Care can call when an egg becomes available. * If you increase the number of Pokémon allowed in the Day Care at any one time, you will need to significantly modify the breeding code if you want any pair of deposited Pokémon to be able to breed. The bulk of the changes required will be in deciding which two deposited Pokémon are the parents, and dealing with having two or more possible breeding pairs deposited at the same time (note that a single Pokémon could be in several of these pairs at once). ** If you don't want that hassle, you could leave the code pretty much as it is (i.e. breeding only occurs if exactly two Pokémon are deposited). Your explanation of why breeding doesn't occur with 3 or more deposited Pokémon could be that a pair of Pokémon can't get enough privacy from the other(s) to allow them to breed. * You could define one or more Pokémon that are owned by the Day Care itself, which are able to breed with the deposited Pokémon. This can provide access to useful inherited properties, although the player may or may not be outright told what is available. As above, doing this would require major changes to the code. ** (One of) the Day Care Pokémon could be a Ditto, meaning breeding is allowed with any deposited Pokémon that can breed.